#include <iostream>
#include <string>
#include <vector>
#include "vector.h"
using namespace std;

void testvector(const ykh::vector<int> v)
{
	for (size_t i = 0; i < v.size(); ++i)
	{
		cout << v[i] << " ";
	}
	cout << endl;

	ykh::vector<int>::const_reverse_iterator it = v.rbegin();
	while (it != v.rend())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;
}

void testvector1()
{
	ykh::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	
	for (size_t i = 0; i < v.size(); ++i)
	{
		cout << v[i] << " ";
	}
	cout << endl;

	ykh::vector<int>::iterator it = v.begin();
	while (it != v.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
}

void testvector2()
{
	ykh::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);

	for (size_t i = 0; i < v.size(); ++i)
	{
		cout << v[i] << " ";
	}
	cout << endl;

	v.resize(10);
	for (size_t i = 0; i < v.size(); ++i)
	{
		cout << v[i] << " ";
	}
	cout << endl;
}

void testvector3()
{
	ykh::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);

	auto pos = find(v.begin(), v.end(), 3);
	if (pos != v.end())
	{
		pos = v.insert(pos, 30);
	}

	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

	auto del = find(v.begin(), v.end(), 30);
	if (pos != v.end())
	{
		pos = v.erase(pos);
	}

	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
}

void testvector4()
{
	ykh::vector<int> v(10, 1);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

	string s1 = "hello";
	ykh::vector<int> v1(s1.begin(), s1.end());
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;

	int a[] = { 10,20,30,40,50 };
	ykh::vector<int> v2(a, a + 5);
	for (auto e : v2)
	{
		cout << e << " ";
	}
	cout << endl;
}

void testvector5()
{
	ykh::vector<string> v1(5, "1111111111111111111");
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;

	ykh::vector<string> v2(v1);
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;
}

class Solution {
public:
	ykh::vector<ykh::vector<int>> generate(int numRows)
	{
		ykh::vector<ykh::vector<int>> v;
		v.resize(numRows, ykh::vector<int>());
		for (size_t i = 0; i < v.size(); ++i)
		{
			v[i].resize(i + 1, 0);
			v[i][0] = v[i][v[i].size() - 1] = 1;
		}
		for (size_t i = 0; i < v.size(); ++i)
		{
			for (size_t j = 0; j < v[i].size(); ++j)
			{
				if (v[i][j] == 0)
				{
					v[i][j] = v[i - 1][j] + v[i - 1][j - 1];
				}
			}
		}
		return v;
	}
};

void print_testvecttor6(const ykh::vector<int> v)
{
	ykh::vector<int>::const_reverse_iterator crit = v.rbegin();
	while (crit != v.rend())
	{
		cout << *crit << " ";
		++crit;
	}
	cout << endl;
}

void testvector6()
{
	ykh::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);

	/*ykh::vector<int>::reverse_iterator rit = v.rbegin();
	while (rit != v.rend())
	{
		cout << *rit << " ";
		++rit;
	}
	cout << endl;*/

	print_testvecttor6(v);
}

//int main()
//{
//	/*ykh::vector<int> v;
//	v.push_back(1);
//	v.push_back(2);
//	v.push_back(3);
//	v.push_back(4);
//	testvector(v);*/
//	//testvector1();
//	//testvector2();
//	//testvector3();
//	//testvector4();
//	//testvector5();
//	/*ykh::vector<ykh::vector<int>> vv = Solution().generate(5);
//	for (size_t i = 0; i < vv.size(); ++i)
//	{
//		for (size_t j = 0; j < vv[i].size(); ++j)
//		{
//			cout << vv[i][j] << " ";
//		}
//		cout << endl;
//	}*/
//
//	testvector6();
//
//	return 0;
//}

int main()
{
	ykh::vector<int> v{ 1,2,3,4,5 };
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

	return 0;
}